﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
编辑新闻
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadStyles" runat="server"></asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HeadScripts" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
  <% IList<RightsAndTypeModel> objRightsAndType = ViewData["RightsAndType"] as List<RightsAndTypeModel>;%>
  <% IList<AdminGroupRightModel> objAdminGroupRight = ViewData["AdminGroupRightList"] as List<AdminGroupRightModel>;%>

<div class="pd10">
     <form id="mainform" method="post" action="RightsSave">
        <table class="tb-list mt10" id="tbRight">
         <% foreach(var item in objRightsAndType) %>
        <%{%>
            <tr>
                <td class="aR" style="width:200px;">
                   <input type="checkbox" id="chkAllRight_<%=item.RightsType.TypeID%>" value="<%=item.RightsType.TypeID%>"><%=item.RightsType.TypeName%>
                </td>
                <td class="aL">
                <% foreach (var item2 in item.Rights) %>
                <%{%> 
                   <input type="checkbox"  <% if (item2.Checked)  %><%{ %>checked="checked"<%} %> group="chkAllRight_<%=item.RightsType.TypeID%>" name="chkRight_<%=item2.RightID%>" id="chkRight_<%=item2.RightID%>" value="<%=item2.RightID%>" ><%=item2.RightDisplayName%>
                <%}%>
                </td>
            </tr>
              <%}%>
        </table>
        <div class="aC">
            <input name="save" value="保存" type="submit" class="a-btn1" />
            <input name="clear" value="清空" id="clear" type="button" class="a-btn1" />
            <input name="hdGroupID" value="<%= ViewData["GroupID"] %>" type="hidden" />
            </div>
        </form>
    </div>
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="BodyScripts" runat="server">
<script language="javascript" type="text/javascript">
    $(document).ready(function () {

        $("input[type='checkbox'][id^='chkAllRight_']").each(function () {

            $(this).click(function () {
                if (this.checked == true) {
                    $("input[type='checkbox'][group='" + this.id + "']").attr("checked", true);
                } else {
                    $("input[type='checkbox'][group='" + this.id + "']").attr("checked", false);
                }
            });
        });
    });
</script>
</asp:Content>
